#ifndef UMAP_HH
#define UMAP_HH

#include<map>


/**
 * We were too lazy to write contains(map,key) so we extended std::map.
 * I wonder how the C++ committe didn't think about adding this function...
 */
template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
            typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >

class uMap : public std::map<_Key,_Tp,_Compare,_Alloc> {
public:
	bool contains(const _Key& item) const {
		return !(this->find(item) == this->end());
	}

	void insert(const _Key& key, const _Tp& value) {
		if(this->contains(key)) throw "thread library error: Map already contains key.";
		(*this)[key]=value;
	}
};

#endif
